package com.bookshop.mapper;

import com.bookshop.entity.Book;
import com.bookshop.entity.Order;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@Repository
@Mapper
public interface OrderMapper {
    int addToOrder(@Param("orderNo") String orderNo , @Param("totalAmount") double totalAmount , @Param("createTime") Date createTime , @Param("payStatus") int payStatus , @Param("userId") int userId);
    int getOrderId(@Param("orderNo") String orderNo);
    int addBookToOrder(@Param("orderId") int orderId , @Param("bookId") int bookId , @Param("singleAmount") double price , @Param("bookNum") int bookNum);
    int deleteOrder(@Param("orderNo") String orderNo);
    int deleteBookFromOrder(@Param("orderId") int orderId);
    int updatePayStatus(@Param("orderNo") String orderNo , @Param("payStatus") int payStatus , @Param("pay_time") Date payTime);
    int updateOutTime(@Param("orderNo") String orderNo , @Param("payStatus") int payStatus);
    List<Book> getOrderList(@Param("orderId") int orderId);
    Order getOrderInfo(@Param("orderId") int orderId);
    ArrayList<Order> searchByStatus(@Param("payStatus") int payStatus , @Param("userId") int userId);
    Order searchByOrderNo(@Param("orderNo") String orderNo);
    int getPayStatus (@Param("OrderNo") String orderNo);
    ArrayList<Order> getAllOrder(@Param("userId") int userId);
}
